<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>calypso_sam_commands_c.html</title>
<!-- Source : c:/temp/calypso/calypso_sam_commands.c -->
<!-- Doc generated on Thu Jun 24 12:26:45 2010 by johann on PC_DEV_5 -->
<!-- Generated with ROBODoc Version 4.99.8 (Specific build by PRO ACTIVE - Apr 13 2010) -->
<style type="text/css">
body
{
  background-color: #ffffff;
  color: #000000;
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 9pt;
  margin-left: 60px;
  margin-right: 40px;  
}
table
{
  border-collapse: collapse;
  border-style: solid;
  border-width: 1px;
  border-color: #000000;
  margin-bottom: 12px;
}
td
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 9pt;
  vertical-align: top;
  padding-right: 6px;
  border-style: solid;
  border-width: 1px;
  border-color: #dddddd; 
}
th
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 9pt;
  vertical-align: top;  
  padding-right: 6px;
  border-style: solid;
  border-width: 1px;
  border-color: #000000;
  background-color: #dddddd;  
}
h1
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 18pt;
  font-weight: bold;
  margin-bottom: 36px;
  color: #000000;
  margin-left: -40px;
}
h2
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 12pt;
  font-weight: bold;
  margin-top: 48px;
  margin-bottom: 24px;
  padding-top: 2px;
  padding-bottom: 2px;
  background-color: #dddddd;
  color: #000000;
  margin-left: -40px;
}
h3
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 11pt;
  font-weight: bold;
  margin-top: 36px;
  margin-bottom: 24px; 
  border-style: none;
  border-top-style: solid;  
  border-width: 1px;
  border-color: #cccccc; 
  margin-left: -40px;
}
h4
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 11pt;
  font-weight: bold;
  margin-top: 24px;
  margin-bottom: 12px;  
}
h5
{
  font-family: Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
  font-size: 9pt;
  font-weight: bold;
  margin-top: 12px;
  margin-bottom: 2px;  
}
a
{
  color: #0000ff;
}
p
{
  margin-top: 0px;
  margin-bottom: 6px;  
  width: 600px;
  text-align: justify;
}
ul
{
  margin-top: 0px;
  margin-bottom: 6px;  
  width: 600px;
  text-align: justify;
}
li
{
  margin-top: 0px;
  margin-bottom: 6px;  
  width: 550px;
  text-align: justify;
}
tt
{
  font-family: Courier, Courier New;
  font-size: 10pt;
}
pre
{
  background-color: #ffffff;
  color: #000000;
  font-size: 10pt;
}
.NAV
{
  font-size: 7pt;
}
a.NAV
{
  color: #0000cc;
}
.TOC
{
  font-size: 9pt;
  color: #888888;
}
a.TOC
{
  color: #0000ff;
}
.INDEX
{
  font-size: 9pt;
}
a.INDEX
{
  color: #0000ff;
}
.TYPE
{
  font-size: 7pt;
  color: #888888;
}
.ITEM
{
  font-weight: bold;
  color: #000088;
}
.LABEL
{
  color: #000088;
}
.HISTORY
{
  color: #006600;
}
.AUTHOR
{
  color: #006600;
}
.COPYRIGHT
{
  color: #006600;
}
.PORTABILITY
{
  color: #006600;
}
.WARNING
{
  color: #aa0000;
}

.bitinfo
{
  width: 60px;
  font-style: italic;
  text-align: center;
}

.bitnum
{
  text-align: center;
}

.bitname
{
  font-weight: bold;
  text-align: center;
}

.tabitem
{
  width: 100px;
}

.tabname
{
  width: 200px;
}

.tabdesc
{
  width: 450px;
}

.value
{
  font-family: courier;
  text-align: right;
}

.tabsepar
{
  border-top-style: solid;
  border-bottom-style: solid;
  border-width: 2px;
  border-color: #888888;
  font-style: italic;
  text-align: center;
}
</style>
</head>
<body bgcolor="#FFFFFF">
<a name="robo_top_of_doc"></a>
<h3 align="center">TABLE OF CONTENTS</h3>
<ul>
<li><a class="TOC" href="#robo24">Calypso_SAM_Commands.c</a></li>
<li><a class="TOC" href="#robo118">CalypsoSamCipherCardDataEx</a></li>
<li><a class="TOC" href="#robo119">CalypsoSamDigestAuthenticate</a></li>
<li><a class="TOC" href="#robo120">CalypsoSamDigestClose</a></li>
<li><a class="TOC" href="#robo121">CalypsoSamDigestInit</a></li>
<li><a class="TOC" href="#robo122">CalypsoSamDigestUpdate</a></li>
<li><a class="TOC" href="#robo123">CalypsoSamGetChallenge</a></li>
<li><a class="TOC" href="#robo124">CalypsoSamGiveRandom</a></li>
<li><a class="TOC" href="#robo125">CalypsoSamSelectDiversifier</a></li>
</ul>
<h3>&nbsp;</h3>


<h1><a name="robo24"><span class="TYPE">[Modules]</span><a class="LABEL" name="Calypso5fSAM5fCommands2ec">
Calypso_SAM_Commands.c</a></h1>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./modules.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   SpringCard Calypso API :: SAM command set
</pre>
</span><p class="ITEM">COPYRIGHT</p>
<span class="COPYRIGHT"><pre class="COPYRIGHT">   (c) 2008 PRO ACTIVE SAS - See LICENCE.txt for licence information
</pre>
</span><p class="ITEM">AUTHOR</p>
<span class="AUTHOR"><pre class="AUTHOR">   Johann Dantant / PRO ACTIVE
</pre>
</span><p class="ITEM">HISTORY</p>
<span class="HISTORY"><pre class="HISTORY">   JDA 21/10/2008 : first public release
</pre>
</span>


<h2><a name="robo118"><span class="TYPE">[Functions]</span><a class="LABEL" name="CalypsoSamCipherCardDataEx">
CalypsoSamCipherCardDataEx</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>CalypsoSamCipherCardDataEx</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Ask the SAM to cipher data to be transmitted to the card
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   CALYPSO_CTX_ST *ctx         : library context
   BYTE           apdu_p1
   BYTE           apdu_p2
   const BYTE     plain[]
   CALYPSO_SZ     plainsize
   BYTE           cipher[]
   CALYPSO_SZ     *ciphersize
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   CALYPSO_RC                  : 0 or an error code
</pre>
</span>


<h2><a name="robo119"><span class="TYPE">[Functions]</span><a class="LABEL" name="CalypsoSamDigestAuthenticate">
CalypsoSamDigestAuthenticate</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>CalypsoSamDigestAuthenticate</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Verify card's signature after <a class="LINK_6" href="./calypso_card_session_c.html#robo95">CalypsoCardCloseSecureSession</a>
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   CALYPSO_CTX_ST *ctx         : library context
   const BYTE     card_sign[4] : signature returned by the card
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   CALYPSO_RC                  : 0 or an error code
</pre>
</span>


<h2><a name="robo120"><span class="TYPE">[Functions]</span><a class="LABEL" name="CalypsoSamDigestClose">
CalypsoSamDigestClose</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>CalypsoSamDigestClose</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   SAM-side counterpart of <a class="LINK_6" href="./calypso_card_session_c.html#robo95">CalypsoCardCloseSecureSession</a>
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   CALYPSO_CTX_ST *ctx        : library context
   BYTE           sam_sign[4] : signature computed by the SAM
                                (to be forwarded to the card)
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   CALYPSO_RC                 : 0 or an error code
</pre>
</span>


<h2><a name="robo121"><span class="TYPE">[Functions]</span><a class="LABEL" name="CalypsoSamDigestInit">
CalypsoSamDigestInit</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>CalypsoSamDigestInit</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   SAM-side counterpart of <a class="LINK_6" href="./calypso_card_session_c.html#robo98">CalypsoCardOpenSecureSession1</a>, <a class="LINK_6" href="./calypso_card_session_c.html#robo99">CalypsoCardOpenSecureSession2</a>
   or <a class="LINK_6" href="./calypso_card_session_c.html#robo100">CalypsoCardOpenSecureSession3</a>
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   CALYPSO_CTX_ST *ctx         : library context
   BYTE           kif          : key identifier
   BYTE           kvc          : key version and counter
   const BYTE     cardresp[]   : card's answer to the open secure session command
                                 (including its challenge)
   CALYPSO_SZ     cardrespsize : length of cardresp
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   CALYPSO_RC                  : 0 or an error code
</pre>
</span>


<h2><a name="robo122"><span class="TYPE">[Functions]</span><a class="LABEL" name="CalypsoSamDigestUpdate">
CalypsoSamDigestUpdate</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>CalypsoSamDigestUpdate</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Forward a card's APDU (in/out) to the SAM
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   CALYPSO_CTX_ST *ctx         : library context
   const BYTE     cardapdu[]   : APDU
   CALYPSO_SZ     cardapdusize : length of the APDU
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   CALYPSO_RC                  : 0 or an error code
</pre>
</span>


<h2><a name="robo123"><span class="TYPE">[Functions]</span><a class="LABEL" name="CalypsoSamGetChallenge">
CalypsoSamGetChallenge</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>CalypsoSamGetChallenge</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Retrieve the challenge from the SAM, to be used in <a class="LINK_6" href="./calypso_card_session_c.html#robo98">CalypsoCardOpenSecureSession1</a>,
   <a class="LINK_6" href="./calypso_card_session_c.html#robo99">CalypsoCardOpenSecureSession2</a> or <a class="LINK_6" href="./calypso_card_session_c.html#robo100">CalypsoCardOpenSecureSession3</a>
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   CALYPSO_CTX_ST *ctx        : library context
   BYTE           sam_chal[4] : the UID of the card
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   CALYPSO_RC                 : 0 or an error code
</pre>
</span>


<h2><a name="robo124"><span class="TYPE">[Functions]</span><a class="LABEL" name="CalypsoSamGiveRandom">
CalypsoSamGiveRandom</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>CalypsoSamGiveRandom</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Feed the SAM with a challenge generated by the card
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   CALYPSO_CTX_ST *ctx         : library context
   const BYTE     challenge[8] : the challenge returned by the card
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   CALYPSO_RC                  : 0 or an error code
</pre>
</span><p class="ITEM">SEE ALSO</p>
<span class="SEE_ALSO"><pre class="SEE ALSO">   <a class="LINK_37" href="./calypso_card_session_c.html#robo96">CalypsoCardGetChallenge</a>
</pre>
</span>


<h2><a name="robo125"><span class="TYPE">[Functions]</span><a class="LABEL" name="CalypsoSamSelectDiversifier">
CalypsoSamSelectDiversifier</a></h2>

<p class="NAV">[<a class="NAV" href="#robo_top_of_doc">top</a>][<a class="NAV" href="./functions.html#top">index</a>]</p>
<p class="ITEM">NAME</p>
<span class="NAME"><pre class="NAME">   <strong>CalypsoSamSelectDiversifier</strong>
</pre>
</span><p class="ITEM">DESCRIPTION</p>
<span class="DESCRIPTION"><pre class="DESCRIPTION">   Feed the SAM with the UID of the card currently being worked on
</pre>
</span><p class="ITEM">INPUTS</p>
<span class="INPUTS"><pre class="INPUTS">   CALYPSO_CTX_ST *ctx        : library context
   const BYTE     card_uid[8] : the UID of the card
</pre>
</span><p class="ITEM">RETURNS</p>
<span class="RETURNS"><pre class="RETURNS">   CALYPSO_RC                 : 0 or an error code
</pre>
</span>
<hr />
Generated from <b>calypso_sam_commands.c</b> on Thu Jun 24 12:26:45 2010<br />
</body>
</html>
